package com.wish.g04.financial.controller;

import com.wish.g04.common.core.web.controller.BaseController;
import com.wish.g04.common.core.web.domain.AjaxResult;
import com.wish.g04.common.core.web.page.TableDataInfo;
import com.wish.g04.financial.dto.CfContractDto;
import com.wish.g04.financial.dto.JrRentInstallmentDTO;
import com.wish.g04.financial.service.TbJrRenInstallmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 租房分期
 */
@RestController
@RequestMapping("/stageRenting")
public class StageRentingController extends BaseController {

    @Autowired
    TbJrRenInstallmentService tbJrRenInstallmentService;

    /**
     * 租房分期  租房合同列表
     */
    @GetMapping("getStageRentingList")
    public TableDataInfo getStageRentingList(CfContractDto cfContractDto){
        startPage();
        return tbJrRenInstallmentService.getStageRentingList(cfContractDto);
    }

    /**
     * 获取金融产品 可用数据 做下拉框列表
     */
    @GetMapping("getJRAProductList/{id}")
    public AjaxResult getJRAProductList(@PathVariable("id") Integer jrProductType){
        return tbJrRenInstallmentService.getJRAProductList(jrProductType);
    }

    /**
     *  根据租房合同id查询
     */
    @GetMapping("getRentingContractById/{id}")
    public AjaxResult getRentingContractById(@PathVariable Integer id){
        return tbJrRenInstallmentService.getRentingContract(id);
    }

    /**
     *  添加租房分期申请
     */
    @PostMapping("saveStageRenting")
    public AjaxResult saveStageRenting(JrRentInstallmentDTO jrRentInstallmentDto){
        return tbJrRenInstallmentService.saveStageRenting(jrRentInstallmentDto);
    }

    /**
     *  金融计算器
     */
    @PostMapping("counter")
    public AjaxResult counter(JrRentInstallmentDTO jrRentInstallmentDto){
        return tbJrRenInstallmentService.counter(jrRentInstallmentDto);
    }


}
